define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'evaluation.qrcode/index',
        add_url: 'evaluation.qrcode/add',
        edit_url: 'evaluation.qrcode/edit',
        delete_url: 'evaluation.qrcode/delete',
        export_url: 'evaluation.qrcode/export',
        import_url: 'evaluation.qrcode/import',
        modify_url: 'evaluation.qrcode/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh','export','add',
                    [{
                        text: '导入',
                        url: init.import_url,
                        method: 'open',
                        auth: 'import',
                        class: 'layui-btn layui-btn-normal layui-btn-sm',
                        icon: 'fa fa-plus ',
                        // extend: 'data-full="true"',
                    }]
                ],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id',search:false},
                    {field: 'evaluationTemplate.name', title: '模板名称',search:false},
                    {field: 'class_name', title: '班级名称',search:false},
                    {field: 'class_desc', title: '班级描述',search:false},
                    {field: 'class_time', title: '上课时间',search:false},
                    {field: 'qr_code', title: '二维码图片',search:false, templet: ea.table.image},
                    // {field: 'link_address', title: 'link_address',search:false},
                    {field: 'evaluate_period_time', title: '截至时间',search:false},
                    {field: 'student_arr', title: '学生姓名',search:false},
                    {field: 'is_check', title: '是否校验',search: 'select', selectList: {0: '否', 1: '是'},},
                    {field: 'systemAdmin.username', title: '生成人',search:false},

                    {field: 'create_time', title: '创建时间',search:false},
                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        export:function(){
            ea.listen();
        },
        import:function(){
            ea.listen();
        },
    };
    return Controller;
});